1. Field of the Invention
The present invention relates to execution processors for carrying out power calculation of numerals, and more particularly, to an execution processor using a multiplier and a square root calculation unit incorporated in the processor.
2. Description of the Background Art
In carrying out numerical calculation with a computer, the hardware such as of an arithmetic logic unit and a multiplier are prepared. Numerical calculation of a high level is carried out by executing a program which is a combination of the basic computation features of the units.
Conventional art 1: For example, a method of obtaining the eth power (e is an integer) of x, x.sup.e is disclosed in "Iwanamikouza Jouhoukagaku 10 Kihontekisanpou" (Iwanami Course Information Science 10 Fundamental Algorithm), pp. 147-151, Iwanamishoten. This method will be described hereinafter with reference to FIG. 1.
Let the binary representation of e be:
e=b.sub.m-1 b.sub.m-2 . . . b.sub.0 (m&gt;1, i=0, 1, b.sub.m-1 =1) PA1 x.sup.e =exp (e.times.log (x))
The variable y indicating the result is set as y=x, and the variable i indicating the bit to be checked is set as i=m-2 (S22). When i is a negative numeral (FALSE in S24), the process ends since there is no data of that bit. When the data of that bit is present (TRUE at S24), y is substituted with y.sup.2 (S26). When b.sub.i =1 (TRUE at S28), y is further substituted with y.times.x (S30). When b.sub.i =0 (FALSE at S28), no action is taken. According to the process of S26 to S30, y is substituted with y.sup.2 .times.x and y.sup.2 when b.sub.i =1 and b.sub.i =0, respectively. The value of i is decremented by 1 (S32), and the process from S26 to S30 is carried out until i=0. Thus, the power calculation result x.sup.e of an integer exponent is obtained.
Conventional art 2: A method of obtaining the eth power (e is a real number) of x, x.sup.e is disclosed in "Iwanamikouza Jouhoukagaku 18 Suuchikeisan" (Iwanami Course Information Science 18 Numeric Computation), pp. 29-32 by Iwanamishoten. This method will be described hereinafter with reference to FIGS. 2 and 3.
The following notation can be provided.
By preparing a software library function of the logarithmitic function (log) and exponential function (exp), x.sup.e can be obtained.
The value of obtaining the logarithmitic function of z=log (y) of n-bit precision will be described with reference to FIG. 2. It is assumed that the value of -log(1+2.sup.-k)(k=1, 2, . . . , n) is prepared in advance as a constant. First, y.sub.0 =y, z.sub.0 =0, and k=1 are set (S42). The process set forth in the following is carried out by altering the value of k from 1 to n. When the value of k is n or smaller (TRUE in S44), the following is obtained (S46). EQU w=yk-1.times.(1+2.sup.-k)
When w.gtoreq.1 (TRUE in S48), yk=yk-1, z.sub.k =z.sub.k-1 are set (S50). When w&lt;1 (FALSE at S48), y.sub.k =w, z.sub.k =z.sub.k-1 -log(1+2.sup.-k) are set (S52). Then, the value of k is incremented by 1 (S54). This process of S44-S54 is repeated. When the value of k becomes greater than n (FALSE at S44), the process ends. The current z.sub.k is the value to be obtained.
The method of obtaining the exponential function y=exp(z) of n-bit precision will be described with reference to FIG. 30. It is assumed that the value of -log (1+2.sup.-k) (k=1, 2, . . . , n) is prepared in advance as a constant. First, y.sub.0 =1, z.sub.0 =z, and k=1 are set (S62). The process set forth in the following is carried out by altering the value of k from 1 to n. When the value of k is n or smaller (TRUE at S64), the following is obtained (S66). EQU w=z.sub.k-1 -log(1+2.sup.-k)
When w.gtoreq.0 (TRUE at S68), Y.sub.k =Y.sub.k-1 .times.(1+2.sup.-k), z.sub.k =w are set (S70). When w&lt;0 (FALSE at S68), Y.sub.k =Y.sub.k-1, z.sub.k -z.sub.k-1 are set (S72). Then, the value of k is incremented by 1 (S74). The process from S64-S74 is repeated. When the value of k becomes greater than n (FALSE at S64), the process is terminated. The current y.sub.k is the value to be obtained.
According to the computer executing the power calculation of the integer exponent in conventional art 1, multiplication is carried out (2m-1) times. However, the process according to software requires operation for control other than for multiplication, such as bit determination as shown in S28 of FIG. 1, loop control, and the detection of the most significant bit of 1 in the register storing the exponent. There was a problem that this process is time consuming.
In the computer for executing the power calculation of a real number exponent according to conventional art 2, a memory region for storing in advance the value of -log(1+2.sup.-k) (k=1, 2, . . . , n) as a constant is necessary. Furthermore, there was a problem that the total time for processing is extremely great since the process for calculating the exponential function is time consuming.